package com.acme.task4;

public class Task4Arrays {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		task4Test();

	}
	
	public static void task4Test(){
		
		int array[] = new int[10];
		
		array[0] = 3;
		array[1] = 7;
		array[2] = 3;
		//...
		
		AnalysisArray(array);
		AnalysisArray2(array);
		
	}
	
	public static void AnalysisArray(int mas[]) {
		
		int num3=0,num7=0,num9=0;
		for (int i = 0; i < mas.length; i++) {
			if(mas[i] == 3)
				num3++;
			if(mas[i] == 7)
				num7++;
			if(mas[i] == 9)
				num9++;
			
		}

		System.out.println("Number of 3: " + num3);
		System.out.println("Number of 7: " + num7);
		System.out.println("Number of 9: " + num9);
		
	}
	
	public static void AnalysisArray2(int mas[]) {

		System.out.println("Number of 3: " + countnum(mas,3));
		System.out.println("Number of 7: " + countnum(mas,7));
		System.out.println("Number of 9: " + countnum(mas,9));
		
	}

	public static int countnum(int mas[], int num) {
		int count=0;
		for (int i = 0; i < mas.length; i++) {
			if(mas[i] == num)
				count++;
		}
		
		return count;
	} 
	
}
